package com.dc.trans.steps.bwzh;

import java.awt.Cursor;
import java.awt.dnd.DragGestureEvent;
import java.awt.dnd.DragGestureListener;
import java.awt.dnd.DragSource;
import java.awt.dnd.DragSourceDragEvent;
import java.awt.dnd.DragSourceDropEvent;
import java.awt.dnd.DragSourceEvent;
import java.awt.dnd.DragSourceListener;
import java.awt.dnd.DropTarget;
import java.awt.dnd.DropTargetDragEvent;
import java.awt.dnd.DropTargetDropEvent;
import java.awt.dnd.DropTargetEvent;
import java.awt.dnd.DropTargetListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionAdapter;

import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.tree.DefaultMutableTreeNode;

//import com.digitalchina.dcflexwork.studio.node.NodePopupMenu;
/**
 * 增加了映射节点的button
 * @author Administrator
 *
 */
public class MiddleJlabel extends JPanel implements DragGestureListener,
DragSourceListener,DropTargetListener
{   
	/**
	 * 拖拽中的源节点，将其做为静态对象是为了在多棵树之间共享源节点
	 */
	private int  id;
	int x1;//节点坐标
	int y1;
	private static DefaultMutableTreeNode sourceNode;
	private static MiddleJlabel  sourceNode1;
	private DefaultMutableTreeNode targetNode;
	private MiddleJlabel targetNode1;
	
	//private MappedPanel jp=null;  
	private DragSource dragSource;

	private DropTarget dropTarget;
	
	private String targetName;
	
	private String sourceName;
	private boolean isForEach;//设置此表达式是否为循环节点
	private boolean isForeachParent;

	public boolean isForeachParent() {
		return isForeachParent;
	}

	public void setIsForeachParentt(boolean isParent) {
		this.isForeachParent = isParent;
	}

	public boolean isForEach() {
		return isForEach;
	}

	public void setForEach(boolean isForEach) {
		this.isForEach = isForEach;
	}

	/**
	 * 放下拖拽时产生的行为
	 */
	private DropAction dropAction;
	public MiddleJlabel()
	{
		super();
		
	}
	
	/**
	 * 返回拖拽行为对象
	 * 
	 * @return
	 */
	public DropAction getDropAction() {
		return dropAction;
	}

	/**
	 * @param dropAction
	 *            The dropAction to set.
	 */
	public void setDropAction(DropAction dropAction) {
		this.dropAction = dropAction;
	}

	public DragSource getDragSource() {
		return dragSource;
	}

	public void setDragSource(DragSource dragSource) {
		this.dragSource = dragSource;
	}

	@Override
	public DropTarget getDropTarget() {
		return dropTarget;
	}

	@Override
	public void setDropTarget(DropTarget dropTarget) {
		this.dropTarget = dropTarget;
	}
	

		public void dragGestureRecognized(DragGestureEvent dge)
		{
		MappedManager.dragGestureRecognized(dge, this);
		}
		public void dragDropEnd(DragSourceDropEvent arg0)
		{
			// TODO Auto-generated method stub
			
		}
		public void dragEnter(DragSourceDragEvent arg0)
		{
			// TODO Auto-generated method stub
			
		}
		public void dragExit(DragSourceEvent arg0)
		{
			// TODO Auto-generated method stub
			
		}
		public void dragOver(DragSourceDragEvent arg0)
		{
			// TODO Auto-generated method stub
			
		}
		public void dropActionChanged(DragSourceDragEvent arg0)
		{
			// TODO Auto-generated method stub
			
		}
		public void dragEnter(DropTargetDragEvent arg0)
		{
			// TODO Auto-generated method stub
			
		}
		public void dragExit(DropTargetEvent arg0)
		{
			// TODO Auto-generated method stub
			
		}
		public void dragOver(DropTargetDragEvent arg0)
		{
			// TODO Auto-generated method stub
			
		}
		public void drop(DropTargetDropEvent dge)
		{
			MappedManager.drop(dge, this);
			
		}
		public void dropActionChanged(DropTargetDragEvent arg0)
		{
			// TODO Auto-generated method stub
			
		}

		public static DefaultMutableTreeNode getSourceNode()
		{
			return sourceNode;
		}

		public static void setSourceNode(DefaultMutableTreeNode sourceNode)
		{
			MiddleJlabel.sourceNode = sourceNode;
		}

		public static MiddleJlabel getSourceNode1()
		{
			return sourceNode1;
		}

		public static void setSourceNode1(MiddleJlabel sourceNode1)
		{
			MiddleJlabel.sourceNode1 = sourceNode1;
		}

		public DefaultMutableTreeNode getTargetNode()
		{
			return targetNode;
		}

		public void setTargetNode(DefaultMutableTreeNode targetNode)
		{
			this.targetNode = targetNode;
		}

		public MiddleJlabel getTargetNode1()
		{
			return targetNode1;
		}

		public void setTargetNode1(MiddleJlabel targetNode1)
		{
			this.targetNode1 = targetNode1;
		}

		public int getId()
		{
			return id;
		}

		public void setId(int id)
		{
			this.id = id;
		}

		public int getx()
		{
			return x1;
		}

		public void setx(int x)
		{
			this.x1 = x;
		}

		public int gety()
		{
			return y1;
		}

		public void sety(int y)
		{
			this.y1 = y;
		}

		public String getTargetName()
		{
			return targetName;
		}

		public void setTargetName(String targetName)
		{
			this.targetName = targetName;
		}

		public String getSourceName()
		{
			return sourceName;
		}

		public void setSourceName(String sourceName)
		{
			this.sourceName = sourceName;
		}
}